#ifndef XITEMTOKEN_H
#define XITEMTOKEN_H
#include <sstream>
#include <xscript/xitem.h>
#include <xscript/xtoken.h>

class XItemToken : public XItem
{
public:
    XItemToken() = delete;
    XItemToken(std::shared_ptr<XToken> token):
        tokenValue(token)
    {
        setName(token->getString());
        setValueType(XItemValueType_EnumToken);
    }
public:
    std::shared_ptr<XToken> getToken()const
    {
        return tokenValue;
    }

    std::wstring getItemInfo()override
    {
        std::wstringstream stream;
        stream << tokenValue->getString();
        return stream.str();
    }

    std::shared_ptr<XItemToken> asToken()override {
        return std::dynamic_pointer_cast<XItemToken>(shared_from_this());
    }
protected:
    std::shared_ptr<XToken> tokenValue;
};

#endif // XITEMTOKEN_H
